package sword;

/**
 * @Author: 海琳琦
 * @Date: 2022/5/27 11:23
 * https://leetcode.cn/problems/di-yi-ge-zhi-chu-xian-yi-ci-de-zi-fu-lcof/
 */
public class Title50 {

    public char firstUniqChar(String s) {
        int[] arr = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            arr[c - 'a']++;
            //单词只出现过一次
            if (arr[c - 'a'] == 1 && s.indexOf(c, i + 1) == -1) {
                return s.charAt(i);
            }
        }
        return ' ';
    }

    public static void main(String[] args) {

    }
}
